package com.yf.dxapp.module.app.config;

import cn.iocoder.yudao.framework.security.config.SecurityProperties;
import cn.iocoder.yudao.framework.web.core.handler.GlobalExceptionHandler;
import cn.iocoder.yudao.module.system.api.oauth2.OAuth2TokenApi;
import com.yf.dxapp.module.app.filter.AppLoginFilter;
import jakarta.annotation.Resource;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(SecurityProperties.class)
public class DxappConfig {

    @Resource
    private SecurityProperties securityProperties;

    @Bean
    public AppLoginFilter appLoginFilter(GlobalExceptionHandler globalExceptionHandler,
                                                               OAuth2TokenApi oauth2TokenApi) {
        return new AppLoginFilter(securityProperties, globalExceptionHandler, oauth2TokenApi);
    }
}
